package cn.dglydrpy.study.j2ee.hdfs.rpc;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;

import java.io.IOException;
import java.net.InetSocketAddress;

/**
 * Rpc 客户端
 */
public class RpcClient {
    public static void main(String[] args) throws IOException {
        //获取远程Ppc Server 的代理
        RpcProtocol proxy = RPC.getProxy(RpcProtocol.class, 1L,
                new InetSocketAddress("localhost", 8888),
                new Configuration());

        //像调用本地方法一样调用远程方法
        String result = proxy.login("zs", "123456");

        System.out.println("客户端结果:"+result);


    }
}
